package hczc.longcai.com.hccrowdfunding.home.fourth_mine.activities;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;

import hczc.longcai.com.hccrowdfunding.R;
import hczc.longcai.com.hccrowdfunding.activity.BaseActivity;

public class ApproveActivity extends BaseActivity implements View.OnClickListener {

    private static final int STATE_FIRST = 0;
    private static final int STATE_SECOND = 1;

    private int state = 0;
    private RelativeLayout one;
    private LinearLayout second;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_approve);

        initViews();


    }

    private void initViews() {
        findViewById(R.id.head_back).setOnClickListener(this);
        ((TextView) findViewById(R.id.head_title)).setText("身份认证");

        findViewById(R.id.approve_enter).setOnClickListener(this);
        findViewById(R.id.approve_button).setOnClickListener(this);

        one = ((RelativeLayout) findViewById(R.id.approve_no_layout));
        second = ((LinearLayout) findViewById(R.id.approve_yes));
    }

    @Override
    public void onClick(View v) {
        int id = v.getId();
        switch (id){
            case R.id.head_back:
                if(state == STATE_SECOND){
                    second.setVisibility(View.GONE);
                    one.setVisibility(View.VISIBLE);
                    state = STATE_FIRST;
                }else
                finish();
                break;

            case R.id.approve_enter:
                one.setVisibility(View.GONE);
                second.setVisibility(View.VISIBLE);
                state = STATE_SECOND;
                break;

            case R.id.approve_button:
                Toast.makeText(ApproveActivity.this,"认证成功！",Toast.LENGTH_SHORT).show();
                break;
        }
    }
}
